package com.sws.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.annotations.GenericGenerator;


@Entity
@Table(name = "USER")
public class User {

	private static final long serialVersionUID = 8496087166198616020L;
	private String userId;

	@Size(min=3, max=20, message="Username must be between 3 and 20 characters long.")
	@Pattern(regexp="^[a-zA-Z0-9]+$",message="Username must be alphanumeric with no spaces")
	private String userName;
	@Size(min=6, max=20,message="The password must be at least 6 characters long.")
	private String password;
	@Pattern(regexp="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}",message="Invalid email address.")
	private String email;
	
	private String fbId;
	private String birthday;
	private String gender;
	private String location;
	
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(name = "USER_ID")
	public String getUserId() {
		return userId;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	@Column(name = "USER_NAME")
	public String getUserName() {
		return userName;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "PASSWORD")
	public String getPassword() {
		return password;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "EMAIL")
	public String getEmail() {
		return email;
	}
	
	public String toString(){
		return userId+","+email+","+userName;
	}

	public void setFbId(String fbId) {
		this.fbId = fbId;
	}

	@Column(name = "FB_ID")
	public String getFbId() {
		return fbId;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	@Column(name = "FB_BIRTHDAY")
	public String getBirthday() {
		return birthday;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name = "FB_GENDER")
	public String getGender() {
		return gender;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	@Column(name = "FB_LOCATION")
	public String getLocation() {
		return location;
	}	
	
	
}
